home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- From: jgustafs@sisna.com (Josh Gustafson)
- Subject: Re: C++ Shortcomings ?
- Organization: Source Internet Services
- References: <31488E8D.167E@aw.sgi.com> <4iaqch$moh@B1FF.mindspring.com>
- X-Newsreader: News Xpress 2.0 Beta #0
- Date: Sat, 16 Mar 96 15:11:28 GMT
- NNTP-Posting-Host: dialup1114.sisna.com
- Message-ID: <314ac676.0@news.sisna.com>
- Path: news.sisna.com!DIALUP1114
-
- In article <4iaqch$moh@B1FF.mindspring.com>, rudd@mindspring.com wrote:
- >Emmanuel Mogenet <mgix@aw.sgi.com> wrote:
- >>2. Pointer type manipulation
- >>-----------------------------
- >
- >>A very disappointing thing in C++ (unless I am mistaken and it is actually
- >>possible to do so) is the following situation:
- >
- >>If A is a class, then most operations on A can be redefined.
- >>Because A is a full blown type.
- >
- >>Sadly, the same can not be said about A* (type: pointer to A).
- >
- >>Even though A* is a type, none of its default manipulations
- >>can be redefined.
- >
- >>Example: You can tell C++, that you want to gain control of the
- >>situation whenever an object of type A is duplicated.
- >
- >>You do so by redefining the default copy constructor and the default
- >>assignment operator.
- >
- >>But can you tell C++ that you want to gain control whenever a pointer of
- >>A* is duplicated ? Why can't I redefine the copy constructor for the type A* ?
- >
- >>In my way of looking at thing, that'd be a *great* way of doing clean
- > reference
- >>counting, instead of half-baked method using a redefinition of operator->.
- >
- >>Comments ?
- >
- >Ok...so you are saying you can do something like this...
- >
- >A a1, a2;
- >
- >a1 = a2;
- >
- >But you want to be able to do this
- >
- >A a1, *a2;
- >
- >a1 = a2;
-
- Actually, I think he means he wants to be able to do this:
-
- A *a1, *a2;
-
- a1 = a2;
-
-
- Sorry, though, no help here, I'm a newbie to OOP. :-)
-
-
- --
- Josh Gustafson (jgustafs@sisna.com)
-